package com.hunk.utils;

import java.net.InetAddress;
import java.net.UnknownHostException;

import com.hunk.utils.io.Print;

/**
 * Mac信息工具类
 * @author HunkDeng
 * 
 */
public class MacUtils {
	public static void main(String[] args) {
		try {
			Print.println(getIpFromHost("shagri-nyxx.oicp.net"));
		} catch (UnknownHostException e) {
			e.printStackTrace();
		}
	}

	/**
	 * 用本地的DNS将域名转换成IP地址
	 * 
	 * @param hostName
	 *            域名
	 * @return 转换后的ip地址
	 * @throws UnknownHostException
	 *             无法解析该域名时抛出
	 */
	public static String getIpFromHost(String hostName)
			throws UnknownHostException {
		return InetAddress.getByName(hostName).getHostAddress();
	}
}
